<?php

/**
 * Food form base class.
 *
 * @package    form
 * @subpackage food
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseFoodForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'food_id'          => new sfWidgetFormInputHidden(),
      'shop_id'          => new sfWidgetFormDoctrineChoice(array('model' => 'Shop', 'add_empty' => false)),
      'food_type_id'     => new sfWidgetFormDoctrineChoice(array('model' => 'FoodType', 'add_empty' => false)),
      'food_name'        => new sfWidgetFormInput(),
      'food_description' => new sfWidgetFormTextarea(),
      'food_status'      => new sfWidgetFormInput(),
      'food_price'       => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'food_id'          => new sfValidatorDoctrineChoice(array('model' => 'Food', 'column' => 'food_id', 'required' => false)),
      'shop_id'          => new sfValidatorDoctrineChoice(array('model' => 'Shop')),
      'food_type_id'     => new sfValidatorDoctrineChoice(array('model' => 'FoodType')),
      'food_name'        => new sfValidatorString(array('max_length' => 255)),
      'food_description' => new sfValidatorString(),
      'food_status'      => new sfValidatorInteger(),
      'food_price'       => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('food[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Food';
  }

}
